﻿using System;

using Fuse8.DomainFramework.Domain;

using Fuse8.ContentManagementFramework.Domain.Commands.CommandParameters;

namespace Fuse8.ContentManagementFramework.Domain.Commands
{
    public abstract class CmsEntityGetDraftRevisionsCommand<TEntity> : BaseEntityParameterCommand<TEntity, CmsEntityWorkflowRevisionsCommandParameter>
        where TEntity : class, IEntityObject
    {
        private readonly string _typeParameter = typeof(TEntity).Name;

        #region Overrides

        public override string CacheKey
        {
            get
            {
                return string.Format("SiteGroup_{0};Site_{1};EntityTypeParameter_{2}",
                    CommandParameter.SiteGroupId.GetValueOrDefault(0),
                    CommandParameter.SiteId.GetValueOrDefault(0),
                    _typeParameter);
            }
        }

        public override string CommandName
        {
            get
            {
                return string.Format("Cms{0}GetDraftRevisionsCommand", _typeParameter);
            }
        }

        #endregion
    }
}
